import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)
/**
 * showTabBar:是否显示tabbar
 * needLogin:是否需要登录才能访问该页面
 */
const appRoutes = [
    {
        path: '/space/app/yiban',
        name: "yibanApp",
        component: () => import(/* webpackChunkName: "space" */ '../views/App/YiBanApp'),
        meta: {
            title: 'yiban打卡',
            needLogin: true
        }
    },
    {
        path: '/space/app/chaoxing',
        name: "chaoXingApp",
        component: () => import(/* webpackChunkName: "space" */ '../views/App/chaoxing/ChaoXingApp'),
        meta: {
            title: 'chaoXing自动打卡',
            needLogin: true
        }
    },
    {
        path: '/space/app/chaoxing/course/setting',
        name: "chaoXingAppSettings",
        component: () => import(/* webpackChunkName: "space" */ '../views/App/chaoxing/CourseSetting'),
        meta: {
            title: 'chaoXing自动打卡',
            needLogin: true
        }
    },
    {
        path: '/space/app/chaoxing/course/setting/checkin',
        component: () => import(/* webpackChunkName: "space" */ '../views/App/chaoxing/Setting'),
        name: 'chaoXingAppSetting',
        meta: {
            title: 'setting',
        }
    }
]

const routes = [
    {
        path: '/',
        redirect: '/login'
    },
    {
        path: '/blog',
        component: () => import(/* webpackChunkName: "index" */ '../views/Blog'),
        name: "blog",
        meta: {
            title: '看博客',
            icon: 'icon-blog',
            showTabBar: true
        }

    },

    {
        path: '/find',
        name: "find",
        component: () => import(/* webpackChunkName: "index" */ '../views/Find'),
        meta: {
            title: '去冒险',
            icon: 'icon-discovery',
            showTabBar: true
        }
    },
    {
        path: '/store',
        component: () => import(/* webpackChunkName: "index" */ '../views/Store'),
        name: "store",
        meta: {
            title: '小街坊',
            icon: 'icon-store',
            showTabBar: true
        }
    },
    {
        path: '/home',
        component: () => import(/* webpackChunkName: "home" */ '../views/Home'),
        name: "home",
        meta: {
            title: '我的家',
            icon: 'icon-jia',
            showTabBar: true,
            needLogin: true
        }
    },
    {
        path: '/login',
        name: "login",
        component: () => import(/* webpackChunkName: "index" */ '../views/login/Login'),
        meta: {
            title: '登录'
        }
    },
    {
        path: '/register',
        name: "register",
        component: () => import(/* webpackChunkName: "index" */ '../views/login/Register'),
        meta: {
            title: '注册'
        }
    },
    {
        path: '/space',
        name: "space",
        component: () => import(/* webpackChunkName: "space" */ '../views/Space'),
        meta: {
            title: '个人空间',
            needLogin: true
        }
    },
    ...appRoutes,
]


const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router
